package com.market.controller.admin;

import com.market.bean.MarketIssue;
import com.market.bean.common.BasePageInfo;
import com.market.bean.common.BaseRespVo;
import com.market.bean.common.CommonData;
import com.market.service.admin.AdminIssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author fan
 * @Description:
 * @since 2022/12/30 22:12
 */
@RestController
@RequestMapping("admin/issue")
public class AdminIssueController {
    @Autowired
    AdminIssueService issueService;

    @GetMapping("list")
    public BaseRespVo list(BasePageInfo info, String question) {
        CommonData<MarketIssue> data = issueService.list(info, question);
        return BaseRespVo.ok(data);
    }



    @PostMapping("create")
    public BaseRespVo create(@RequestBody MarketIssue marketIssue) {
        MarketIssue data = issueService.create(marketIssue);
        return BaseRespVo.ok(data);
    }



    @PostMapping("update")
    public BaseRespVo update(@RequestBody  MarketIssue marketIssue) {
        MarketIssue data = issueService.update(marketIssue);
        return BaseRespVo.ok(data);
    }

    @PostMapping("delete")
    public BaseRespVo delete(@RequestBody MarketIssue marketIssue) {
        issueService.delete(marketIssue);
        return BaseRespVo.ok();
    }

}
